import request from '@/utils/request'

//首页数据
export function getIndex() {
    return request.get({ url: '/index/index' })
}

//城市
export function getCitys() {
    return request.get({ url: '/index/citys' })
}

// 装修页面
export function getDecorate(data: any) {
    return request.get({ url: '/index/decorate', data }, { ignoreCancel: true })
}

/**
 * @description 热门搜索
 * @return { Promise }
 */
export function getHotSearch() {
    return request.get({ url: '/search/hotLists' })
}

/**
 * @description 获取活动列表
 * @return { Promise }
 */
export function getHuodong() {
    return request.get({ url: '/index/huodong' })
}

/**
 * @description 获取活动详情
 * @param { number } id
 * @return { Promise }
 */
export function getHuodonDetail(data: { id: number }) {
    return request.get({ url: '/index/huodong_detail', data: data })
}

// 活动报名
export function huodongBaoming(data: any) {
    return request.post({ url: '/index/huodong_baoming', data }, { isAuth: true })
}

/**
 * @description 获取合作商户列表
 * @return { Promise }
 */
export function getShanghu(data: Record<string, any>) {
    return request.get({ url: '/index/shanghu', data: data })
}


/**
 * @description 我的活动
 * @return { Promise }
 */
export function getMyHuodong() {
    return request.get({ url: '/index/my_huodong' })
}

/**
 * @description 合作小程序
 * @return { Promise }
 */
export function miniapp() {
    return request.get({ url: '/index/miniapp' })
}

/**
 * @description 公司介绍
 * @return { Promise }
 */
export function about() {
    return request.get({ url: '/index/about' })
}

/**
 * @description 保险团购
 * @return { Promise }
 */
export function tuangou(data: Record<string, any>) {
    return request.get({ url: '/index/tuangou', data: data })
} 

/**
 * @description 获取保险详情
 * @param { number } id
 * @return { Promise }
 */
export function getTuangouDetail(data: { id: number }) {
    return request.get({ url: '/index/tuangou_detail', data: data })
}

// 行驶证识别
export function shibie(data: any) {
    return request.post({ url: '/index/shibie', data }, { isAuth: true })
}

// 身份证识别
export function shibieSFZ(data: any) {
    return request.post({ url: '/index/sfz_card', data }, { isAuth: true })
}

// 提交团购信息
export function insertTuangou(data: any) {
    return request.post({ url: '/index/insert_tuangou', data }, { isAuth: true })
}


// 扫码核销
export function hexiao1(data: any) {
    return request.post({ url: '/index/hexiao1', data }, { isAuth: true })
}

// 扫码核销
export function hexiao2(data: any) {
    return request.post({ url: '/index/hexiao2', data }, { isAuth: true })
}

// 用户的使用记录
export function myService() {
    return request.get({ url: '/index/my_service' })
}

// 商户的核销记录
export function myHexiao() {
    return request.get({ url: '/index/my_hexiao' })
}

// 行业分类
export function hangye() {
    return request.get({ url: '/index/hangye' })
}

// 商户分类
export function shanghutype() {
    return request.get({ url: '/index/shanghu_hangye' })
}

// 逆地理解析城市code
export function getCode(data: any) {
    return request.post({ url: '/index/get_city', data })
}
